﻿Namespace Cues.Converters
	Public Class TransportCueActionToVisibilityConverter
		Implements IValueConverter

		Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.Convert
			Try
				If parameter Is Nothing Then
					If CType(value, Cues.TransportActions) = Cues.TransportActions.StopAllActiveCues Then
						Return Visibility.Hidden
					Else
						Return Visibility.Visible
					End If
				ElseIf CStr(parameter) = "AutoPan" Then
					If CType(value, Cues.TransportActions) = Cues.TransportActions.AutoPan Then
						Return Visibility.Visible
					Else
						Return Visibility.Hidden
					End If
				ElseIf CStr(parameter) = "AutoFade" Then
					If CType(value, Cues.TransportActions) = Cues.TransportActions.AutoFade Then
						Return Visibility.Visible
					Else
						Return Visibility.Hidden
					End If
				Else
					Return Visibility.Hidden
				End If
			Catch ex As Exception
				Return Visibility.Visible
			End Try
		End Function

		Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
			'Try
			'	If CType(value, Visibility) = Visibility.Collapsed OrElse CType(value, Visibility) = Visibility.Hidden Then
			'		Return Cues.TransportActions.StopAllActiveCues
			'	Else
			'		Return Cues.TransportActions.StopSpecificCue
			'	End If
			'Catch
			'	Return Cues.TransportActions.StopSpecificCue
			'End Try
			Throw New NotImplementedException
		End Function
	End Class
End Namespace